.class Lcn/cheln/support/images/FileIconLoader$LoaderThread;
.super Landroid/os/HandlerThread;

# interfaces
.implements Landroid/os/Handler$Callback;


# instance fields
.field private a:Landroid/os/Handler;

.field private synthetic b:Lcn/cheln/support/images/FileIconLoader;


# direct methods
.method public constructor <init>(Lcn/cheln/support/images/FileIconLoader;)V
    .locals 1

    iput-object p1, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    const-string v0, "FileIconLoader"

    invoke-direct {p0, v0}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    return-void
.end method


# virtual methods
.method public final a()V
    .locals 2

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->a:Landroid/os/Handler;

    if-nez v0, :cond_0

    new-instance v0, Landroid/os/Handler;

    invoke-virtual {p0}, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->getLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, v1, p0}, Landroid/os/Handler;-><init>(Landroid/os/Looper;Landroid/os/Handler$Callback;)V

    iput-object v0, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->a:Landroid/os/Handler;

    :cond_0
    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->a:Landroid/os/Handler;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    return-void
.end method

.method public handleMessage(Landroid/os/Message;)Z
    .locals 9

    const/4 v7, 0x0

    const/4 v6, 0x2

    const/4 v5, 0x1

    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    invoke-static {v0}, Lcn/cheln/support/images/FileIconLoader;->a(Lcn/cheln/support/images/FileIconLoader;)Ljava/util/concurrent/ConcurrentHashMap;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentHashMap;->values()Ljava/util/Collection;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_5

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcn/cheln/support/images/FileIconLoader$FileId;

    invoke-static {}, Lcn/cheln/support/images/FileIconLoader;->a()Ljava/util/concurrent/ConcurrentHashMap;

    move-result-object v1

    iget-object v3, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    invoke-virtual {v1, v3}, Ljava/util/concurrent/ConcurrentHashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcn/cheln/support/images/e;

    if-eqz v1, :cond_0

    iget v3, v1, Lcn/cheln/support/images/e;->b:I

    if-nez v3, :cond_0

    new-instance v3, Ljava/io/File;

    sget-object v4, Lcn/cheln/explorer/config/Constants;->b:Ljava/lang/String;

    invoke-direct {v3, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3}, Ljava/io/File;->exists()Z

    move-result v4

    if-nez v4, :cond_1

    invoke-virtual {v3}, Ljava/io/File;->mkdirs()Z

    :cond_1
    iput v5, v1, Lcn/cheln/support/images/e;->b:I

    :try_start_0
    new-instance v3, Ljava/io/File;

    iget-object v4, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    iget-object v4, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    invoke-static {v4}, Lcn/cheln/support/images/FileIconLoader;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v3}, Ljava/io/File;->exists()Z

    move-result v4

    if-nez v4, :cond_4

    sget-object v3, Lcn/cheln/support/images/c;->a:[I

    iget-object v4, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->b:Lcn/cheln/support/images/f;

    iget-object v4, v4, Lcn/cheln/support/images/f;->b:Lcn/cheln/support/images/FileCategoryHelper$FileCategory;

    invoke-virtual {v4}, Lcn/cheln/support/images/FileCategoryHelper$FileCategory;->ordinal()I

    move-result v4

    aget v3, v3, v4
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1

    packed-switch v3, :pswitch_data_0

    move-object v3, v7

    :goto_1
    if-nez v3, :cond_3

    :try_start_1
    iget-object v4, v1, Lcn/cheln/support/images/e;->a:Lcn/cheln/support/images/f;

    iget-object v3, v4, Lcn/cheln/support/images/f;->c:Landroid/graphics/Bitmap;
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    :goto_2
    if-eqz v3, :cond_2

    invoke-virtual {v1, v3}, Lcn/cheln/support/images/e;->a(Ljava/lang/Object;)V

    :cond_2
    iput v6, v1, Lcn/cheln/support/images/e;->b:I

    invoke-static {}, Lcn/cheln/support/images/FileIconLoader;->a()Ljava/util/concurrent/ConcurrentHashMap;

    move-result-object v3

    iget-object v0, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    invoke-virtual {v3, v0, v1}, Ljava/util/concurrent/ConcurrentHashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    goto :goto_0

    :pswitch_0
    :try_start_2
    iget-object v3, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    invoke-static {v3}, Lcn/cheln/support/images/FileIconLoader;->b(Lcn/cheln/support/images/FileIconLoader;)Landroid/content/Context;

    move-result-object v3

    iget-object v4, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    invoke-static {v3, v4}, Lcn/cheln/support/images/h;->a(Landroid/content/Context;Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v3

    goto :goto_1

    :pswitch_1
    iget-object v3, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    iget-object v4, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    invoke-static {v4}, Lcn/cheln/support/images/FileIconLoader;->b(Lcn/cheln/support/images/FileIconLoader;)Landroid/content/Context;

    invoke-static {v3}, Lcn/cheln/support/images/h;->a(Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v3

    goto :goto_1

    :pswitch_2
    iget-object v3, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    const/4 v4, 0x1

    invoke-static {v3, v4}, Landroid/media/ThumbnailUtils;->createVideoThumbnail(Ljava/lang/String;I)Landroid/graphics/Bitmap;

    move-result-object v3

    invoke-static {v3}, Lcn/cheln/support/images/h;->a(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1

    move-result-object v3

    goto :goto_1

    :cond_3
    :try_start_3
    iget-object v4, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    invoke-static {v4}, Lcn/cheln/support/images/FileIconLoader;->b(Lcn/cheln/support/images/FileIconLoader;)Landroid/content/Context;

    iget-object v4, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    iget-object v4, v0, Lcn/cheln/support/images/FileIconLoader$FileId;->a:Ljava/lang/String;

    invoke-static {v4}, Lcn/cheln/support/images/FileIconLoader;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-static {v4, v3}, Lcn/cheln/support/images/h;->a(Ljava/lang/String;Landroid/graphics/Bitmap;)V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_0

    goto :goto_2

    :catch_0
    move-exception v4

    move-object v8, v4

    move-object v4, v3

    move-object v3, v8

    :goto_3
    invoke-virtual {v3}, Ljava/lang/Exception;->printStackTrace()V

    move-object v3, v4

    goto :goto_2

    :cond_4
    :try_start_4
    invoke-virtual {v3}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Landroid/graphics/BitmapFactory;->decodeFile(Ljava/lang/String;)Landroid/graphics/Bitmap;
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_1

    move-result-object v3

    goto :goto_2

    :cond_5
    iget-object v0, p0, Lcn/cheln/support/images/FileIconLoader$LoaderThread;->b:Lcn/cheln/support/images/FileIconLoader;

    invoke-static {v0}, Lcn/cheln/support/images/FileIconLoader;->c(Lcn/cheln/support/images/FileIconLoader;)Landroid/os/Handler;

    move-result-object v0

    invoke-virtual {v0, v6}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    return v5

    :catch_1
    move-exception v3

    move-object v4, v7

    goto :goto_3

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
        :pswitch_1
    .end packed-switch
.end method
